package com.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.entity.StudentSignTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Version: V1.0    <br/>
 * Datetime:   2022/5/13 22:11   <br/>
 * Description: ${DES}
 *
 * @author: chen
 */
@Mapper
public interface StudentSignTaskMapper {
    int deleteByPrimaryKey(Long id);

    int insertSelective(StudentSignTask record);

    StudentSignTask selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StudentSignTask record);

    int updateByPrimaryKey(StudentSignTask record);

    int batchInsert(@Param("list") List<StudentSignTask> list);

    /**
     * 根据签到任务id查询任务
     *
     * @param id 任务id
     * @return 数据列表
     */
    List<StudentSignTask> selectByTaskId(Long id);

    /**
     * 根据任务id删除记录
     *
     * @param id 任务id
     * @return 删除记录数
     */
    int deleteByTaskId(Long id);

    @Select("select * from student_sign_task where task_id = #{signTaskId} and student_id = #{userId}")
    StudentSignTask selectByStudentIdAndTaskId(@Param("userId") Long userId, @Param("signTaskId") Long signTaskId);
}